package org.odk.collect.android.fragments;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import org.odk.collect.android.R;
import org.odk.collect.android.adapters.ProjectListAdapter;
import org.odk.collect.android.model.Project;

public class ProjectListFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.frg_project_list, container, false);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        // create an adapter & assign it to list
        ArrayAdapter adapter = new ProjectListAdapter(getActivity().getApplicationContext(), Project.getDemoProjectList());
        ListView lv = (ListView)getView().findViewById(R.id.lst_projects);
        lv.setAdapter(adapter);
    }
}
